title: Overloading operator>>: cannot bind ‘std::basic_istream<char>’ lvalue to ‘std::basic_istream<char>&&’
body: <p>I have the operator in my header as such:</p>
  
  <pre><code>friend std::istream&amp; operator&gt;&gt; ( std::istream&amp; is, StudentRecord&amp; sr );
  </code></pre>
  
  <p>and in my class:</p>
  
  <pre><code>std::istream&amp; operator&gt;&gt;(std::istream&amp; is ,  StudentRecord&amp; sr){
      is &gt;&gt; sr.name &gt;&gt;std::ws&gt;&gt; sr.surname&gt;&gt;std::ws&gt;&gt;sr.studentNumber&gt;&gt;std::ws;
      getline(is, sr.classRecord);
      return is;
  }
  </code></pre>
  
  <p>However, I get the following error:</p>
  
  <pre><code>std::basic_istream&lt;char&gt;’ lvalue to ‘std::basic_istream&lt;char&gt;&amp;&amp;
  </code></pre>
  
  <p>in a database class:</p>
  
  <pre><code>void Database::read(string f)
  {
  
      studRcrds.clear();
      std::ifstream in(f.c_str());
      string studLine;
      while (!(in.eof()))
      {
  
          getline(in,studLine);
          std::istringstream sin(studLine);
          StudentRecord newStudent();
          sin &gt;&gt; newStudent;
      }
  }
  </code></pre>