title: C++ operator overloading: no known conversion from object to reference?
body: <p>When I try to compile the following (g++ 4.6.3)</p>
  
  <pre><code>class A {};
  
  A&amp; operator*=( A&amp; a, const A&amp; b )
  {
    return a;
  }
  
  A operator*( const A&amp; a, const A&amp; b )
  {
    return A( a ) *= b;
  }
  
  int main( int, char*[] )
  {
    A a, b;
  
    a = a*b;
  
    return 0;
  }
  </code></pre>
  
  <p>I get the error</p>
  
  <pre><code>/tmp/test.cxx: In function ‘A operator*(const A&amp;, const A&amp;)’:
  /tmp/test.cxx:14:20: error: no match for ‘operator*=’ in ‘(* &amp; a) *= b’
  /tmp/test.cxx:14:20: note: candidate is:
  /tmp/test.cxx:6:1: note: A&amp; operator*=(A&amp;, const A&amp;)
  /tmp/test.cxx:6:1: note:   no known conversion for argument 1 from ‘A’ to ‘A&amp;’
  </code></pre>
  
  <p>This puzzles me - how can a conversion from a class to a reference to that class not be known?</p>
  
  <p>Changing the declaration of class A as follows does not have any effect:</p>
  
  <pre><code>class A
  {
  public:
    A() {}
    A( const A&amp; ) {}
  };
  </code></pre>
  
  <p>Same error.</p>
  
  <p>I would be extremely grateful for hints as to what's going on here.</p>