title: Simple questions about cin/cout overloading
body: <p>I know this is pretty basic but I've kind of been guessing up to this point.</p>
  
  <p>Foo is just an object with private inheritance from the string class which is why I cast it. Using examples from Primer C++ (Prata's)</p>
  
  <p>So if I have a function like:</p>
  
  <pre><code>istream &amp; operator&gt;&gt;(istream &amp; is, Foo &amp; f)
  {
        is &gt;&gt; (string &amp;)f;
        return is;
  }
  
  int main()
  {
  
  Foo f;
  
  
  cin &gt;&gt; f; 
  
  }
  </code></pre>
  
  <p>So, once cin >> f is hit, the function is called and the now string is stored in the istream reference. The istream object is now returned and now...? Is the returned istream object's content (the string) now placed automatically within f? Or did I miss a step in understanding how cin works?</p>
  
  <p>Also, if I were to do:</p>
  
  <pre><code>int x;
  
  cin &gt;&gt; f &gt;&gt; x;
  </code></pre>
  
  <p>How would it implicitly look like? Like (cin) >> x?</p>
  
  <p>Finally, one more simple thing. If in a function (which contains an ostream reference) I am in a loop passing over every array item and doing this:</p>
  
  <pre><code>for(int i=0;i &lt; 5;i++)
  {
  os &lt;&lt; array[i] &lt;&lt; "\n";
  }
  </code></pre>
  
  <p>Is the ostream object just compounded each array item within itself?</p>