title: Ambiguous call for overloaded operator for templated class
body: <p>I have a templated class for volume objects where <code>operator+=</code> is implemented as a member function and the <code>operator+</code>is implemented as non-member functions: </p>
  
  <pre><code>template &lt;typename Class&gt;
  Class operator+(Class c1, const Class&amp; c2) {
     return c1 += c2;
  }
  
  // Add a constant to every element in the volume
  template &lt;typename Class, typename dataType&gt;
  Class operator+(Class c, dataType constant) {
     return c += constant;
  }
  
  template &lt;typename Class, typename dataType&gt;
  Class operator+(dataType constant, Class c) {
     return c += constant;
  }
  </code></pre>
  
  <p>Then I try to compile the following:</p>
  
  <pre><code>volume + 1.3;
  </code></pre>
  
  <p>where volume is a derived type from the templated volume class.
  This gives me the following error:</p>
  
  <pre><code>error: ambiguous overload for ‘operator+’ in ‘volume + 1.3’
  </code></pre>
  
  <p>Why is the call ambiguous?</p>