title: Overloaded operator is never called in C++
body: <p>I'm writing a math library as a practical exercise. I've run into some problems when overloading the = operator. When I debuged it, I noticed that the call to vertex1 = vertex2 calls the copy constructor instead. </p>
  
  <p>In the header file I have:</p>
  
  <pre><code>//constructors
  vector3();
  vector3( vector3 &amp;v );
  vector3(float ix, float iy, float iz);
  
  //operator overloading
  vector3 operator =(vector3 p);
  ....
  </code></pre>
  
  <p>In the source file I implemented:</p>
  
  <pre><code>vector3 vector3::operator =(vector3 p)
  {
      vector3 v3;
      v3.x = p.x;
      v3.y = p.y;
      v3.z = p.z;
      return v3;
  }
  </code></pre>
  
  <p>Later on I have a crossproduct method, and I want to use it like so:</p>
  
  <pre><code>vector3 v3;
  v3 = v1.crossProduct(v2);
  </code></pre>
  
  <p>The error message is:
      error: no matching function for call to `vector3::vector3(vector3)'
  but I do not want to call the copy constructor.</p>