Operators on internally defined classes
<pre><code>template &lt;class T&gt;
class A {

    struct B {
         T a,b;
    }

    B&amp; operator+ (B &amp; x, B &amp; y) {
        return B(x.a + y.a, x.b + y.b);
    }    

    int funcA (B &amp; x, B &amp; y){
        return (x + y).a;
    }
};
</code></pre>

<p>As you might guess, during compilation I get "operator+ must take either zero or one argument".
Right. Because in the operator+ the "this" is passed as first argument.
So, the a solution is to locate the operator outside of the class A definition. 
However A's function funcA uses operator+. So it has to be defined before A. But operator+ itself uses class B defined in the A which is a template itself and B is dependent class.</p>

<p>What's the solution?</p>
