title: Overloading "+" in c++
body: <p>i have a problem with overloading the addition.
  this is an example i made to test overloading, but i get a compiler error:
  "iso c++ forbids declaration of operator+ with no type"</p>
  
  <p>i hope you can help me</p>
  
  <pre><code>    #include &lt;iostream&gt;
  
      template &lt;typename T&gt;  
      class foo
      {
          public:
              foo();
              T value;
              void setValue(T svalue);
              friend foo&lt;T&gt; operator+(foo&lt;T&gt; const &amp;foo1, foo&lt;T&gt; const &amp;foo2);
      };
  
      template&lt;typename T&gt;
      foo&lt;T&gt; operator+(foo&lt;T&gt; const &amp;foo1, foo&lt;T&gt; const &amp;foo2)
      {
          return foo1.value + foo2.value;
      }
  
      template &lt;typename T&gt;
      foo&lt;T&gt;::foo()
      {
          value = 0;
      }
  
      template &lt;typename T&gt;
      void foo&lt;T&gt;::setValue(T svalue)
      {
          value = svalue;
      }
  
      int
      main()
      {
          foo&lt;int&gt; ten;
          ten.setValue(10);
          foo&lt;int&gt; five;
          five.setValue(5);
  
          return 0;
      }
  </code></pre>
  
  <p>//edit: sorry, i changed the classname from kamehameha to foo, some kamehameha's were left...</p>
  
  <p>//edit2: i added the return type, now the compiler says: "warning: friend declaration 'foo operator+(foo, foo))' declares a non-template function</p>
  
  <p>'foo foo::operator+(const foo&amp;, const foo&amp;)' must take either zero or one argument</p>