title: Overloading Operators: Does the 1st parameter correspond to the left operand and the 2nd one to the right operand?
body: <p>When writing a <strong>non-member</strong> function to overload an operator, does the 1st parameter correspond to the left operand and the 2nd parameter to the right operand?</p>
  
  <p>I was trying to overload the "&lt;&lt;" operator to use it like this:  </p>
  
  <pre><code>stream &lt;&lt; ClassA &lt;&lt; ClassB
  </code></pre>
  
  <p>Below is an example where <code>FeetInches</code> is a class with member variables <code>feet</code> and <code>inches</code>  .</p>
  
  <p>Is that why this parameter order works:</p>
  
  <pre><code>ostream &amp;operator&lt;&lt;(ostream &amp;strm, const FeetInches &amp;obj)
  {
     strm &lt;&lt; obj.feet &lt;&lt; " feet, " &lt;&lt; obj.inches &lt;&lt; " inches";
     return strm;
  }
  </code></pre>
  
  <p>--</p>
  
  <p>but this parameter order doesn't work?</p>
  
  <pre><code>ostream &amp;operator&lt;&lt;(const FeetInches &amp;obj, ostream &amp;strm)
  {
     strm &lt;&lt; obj.feet &lt;&lt; " feet, " &lt;&lt; obj.inches &lt;&lt; " inches";
     return strm;
  }
  </code></pre>