title: Call parent function inside of child class
body: <pre><code>class Parent;
  class Child;
  
  Parent *parent;
  
  ifstream inf("file.csv");
  inf &gt;&gt; *parent;
  
  //in parent class
  friend istream&amp; operator&gt;&gt; (istream &amp;is, Parent &amp;parent) {
    return parent.read(is);
  }
  
  virtual istream&amp; read(istream &amp;is){
    char temp[80];
    is &gt;&gt; temp;
    // then break temp into strings and assign them to values
    return is;
  }
  
  //virtual istream&amp; read
  </code></pre>
  
  <p>It reads and assigns only first two values to the Parent class.<code>Child</code> class has <code>Parent</code> class values + 3 of its own. </p>
  
  <p>How can I call I call parent's <code>read()</code> function and then child's <code>read()</code> function so parent's function reads first 2 fields in the file and child reads next 3 fields?</p>
  
  <p>I know it's a matter of syntax; I just can't figure how to do that.
  I have tried calling <code>Parent::read(is)</code> inside the child read class, I've tried calling it before the child's <code>read()</code>; I have tried <code>read(is) &gt;&gt; temp</code> but none of them worked. When I called <code>Parent::read(is)</code> and then <code>is &gt;&gt; temp</code>, parent <code>is</code> would return all 5 values of the file.</p>