title: error: passing ‘const ComplexNumber’ as ‘this’ argument of ‘const ComplexNumber& ComplexNumber::operator-=(const Complex)
body: <p>I have received the error message. </p>
  
  <pre><code> ComplexNumber.cpp: In function ‘ComplexNumber operator-(const ComplexNumber&amp;, const ComplexNumber&amp;)’:
      ComplexNumber.cpp:79:27: error: passing ‘const ComplexNumber’ as ‘this’ argument of ‘const ComplexNumber&amp; ComplexNumber::operator-=(const ComplexNumber&amp;)’ discards qualifiers [-fpermissive]
        return lhs.operator-=(rhs);
  </code></pre>
  
  <p>I have tried changing the return of the overloaded function operator- to be ComplexNumber(real, imag), but then I receive an error message of  </p>
  
  <pre><code>ComplexNumber.cpp:61:33: warning: returning reference to temporary [-Wreturn-local-addr]
  </code></pre>
  
  <p>I'm not sure why I'm getting the first error message.  I have researched a bunch and have believe that it might have to do with const.  How do I get rid of this error? Why is it happening?</p>
  
  <p>The code is.</p>
  
  <pre><code>//defined -= operator
  const ComplexNumber&amp; ComplexNumber::operator-=(const ComplexNumber&amp; rhs){
      real = real - rhs.real;
      imag = imag - rhs.imag;
      return *this;   
  }
  
  ComplexNumber operator-(const ComplexNumber&amp; lhs, const ComplexNumber&amp; rhs){
      return lhs.operator-=(rhs);
  }
  </code></pre>