title: Overloading = operator
body: <p>I wrote the following test program: </p>
  
  <pre><code> int main(int argc, char** argv)
     {
  
      ifstream inFile;
      inFile.open("D:\\C++\\Assignments\\in1.txt");
      if (!inFile) {
              cout &lt;&lt; "Unable to open file";
              exit(1); // terminate with error
      }
      Complex a,b,c;
      inFile &gt;&gt; a;
      inFile &gt;&gt; b;
      ofstream out;
      out.open("D:\\C++\\Assignments\\out1.txt");
      out &lt;&lt; a &lt;&lt;endl&lt;&lt; b&lt;&lt;endl;  // dumps data to a stream connected to a file
      out &lt;&lt; c=a &lt;&lt;endl;
      out.close();
  
  
  
    return 0;
    }
  </code></pre>
  
  <p>I have overloaded = as following:</p>
  
  <pre><code>  void Complex::operator=(const Complex &amp;a)//mulptiplication
    {
      real=a.real;
      imag=a.imag;
     }
  </code></pre>
  
  <p>But I am getting errors like: no match for ooperator &lt;&lt;. Can anyone help with the error?</p>