title: Operator overloading and different template parameter
body: <p>I have a problem overloading the operator+ i a templated class.
  Suppose I have</p>
  
  <pre><code>template&lt;typename T&gt;
  struct point{
  
      //Ctors:
      point(){};
      point(T _x, T _y):x(_x),y(_y){};
      point(const point&lt;T&gt;&amp; p):x(p.x),y(p.y){};
  
      template&lt;typename T2&gt;
      point(const point&lt;T2&gt;&amp; p):x(static_cast&lt;T&gt;(p.x)),y(static_cast&lt;T&gt;(p.y)){};
  
  
  
     //Coordinates:
     T x;
     T y;
  
  
     //Operator overloads:
     friend point&lt;T&gt; operator+(point&lt;T&gt; left,point&lt;T&gt; right ){
         return point&lt;T&gt;(left.x+right.x, left.y+right.y);
     }
  
     template&lt;class T2&gt;
     friend point&lt;T&gt; operator+(point&lt;T2&gt; left,point&lt;T&gt; right){
         return point&lt;T&gt;(left)+right;
  
     }
  
     template&lt;class T3&gt;
     friend point&lt;T&gt; operator+(point&lt;T&gt; left,point&lt;T3&gt; right){
         return point&lt;T&gt;(right)+left;
     }
  
  
  };
  </code></pre>
  
  <p>This gives me an ambiguity error when calling.</p>
  
  <pre><code>point&lt;float&gt; p1(1.2,1.4);
  point&lt;int&gt; p2(1,2);    
  point&lt;float&gt; p3 =p1+p2;    
  </code></pre>
  
  <p>This makes sense, but can you tell me good practice on how to fix it?</p>
  
  <p>I need 3 operators, since otherwise the casting might go in the wrong direction. For example disregarding the last operator overload would result in <code>p3.x=2</code> and <code>p3.y=4</code>.</p>
  
  <p>Thanks a lot!</p>