title: C++ overloading >> and<< operators
body: <pre><code>fstream&amp; operator&gt;&gt; (fstream &amp; in, class&amp; obj);
  
  fstream&amp; operator&lt;&lt; (fstream &amp; out, class&amp; obj);
  </code></pre>
  
  <hr>
  
  <p>Is this overloading legal or not?<br>
  And what is it's solution?</p>
  
  <p>Actually l am using files in a program with the help of fstream class objects.
  So I need to overload >>&amp;&lt;&lt; operators so that such statements can work.</p>
  
  <p>File>>obj;
  File&lt;
  
  <p>But would 
  ifstream&amp; operator >> (ifstream &amp; , classname&amp; obj)
  ofstream&amp; operator >> (ofstream &amp; , classname&amp; obj)</p>
  
  <p>Work for fstream objects?</p>