How do the "<<" and ">>" operators do I/O?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4421706/operator-overloading">Operator overloading</a>  </p>
</blockquote>



<p>I'm making a long awaited return to C++ and there's some basic notation that doesn't really seem to be that prominent in other languages.</p>

<p>If you look at this line of code </p>

<pre><code>cout &lt;&lt; "firstvalue is " &lt;&lt; firstvalue &lt;&lt; endl;
</code></pre>

<p>I realise <em>what</em> this does. It write's "firstvalue is x" to the console. x being the value of firstvalue. However, I do not know anything about the "&lt;&lt;" or ">>" double angled brackets. I haven't been able to research them or what they do as I don't know the formal name for them.</p>

<p>My question is, what actually <em>happens</em> (step by step) in the above statement? And what are these "&lt;&lt;" for? I think I understand that cout is a standard library function for writing to the console. However I'm used to either objective-c or dot notation. I do not see what object this "cout" function is a member of.</p>

<p>I can understand printf a little more easily, as at least it provides braces for the arguments. e.g. printf("your string here").</p>
