title: Overload + Operator for Class Data
body: <p>Assume that I have the following basic class where I want to overload operator+:  </p>
  
  <pre><code>class foo {
  private:
      arbitrary datatype
  
  public:
      foo() { set private data; };
      virtual ~foo() {};
  
  };
  </code></pre>
  
  <p>I've always used this format:  </p>
  
  <pre><code>foo operator+( const foo &amp;rhs );
  </code></pre>
  
  <p>However, I've recently stumbled onto some code where the person exclusively used:</p>
  
  <pre><code>friend foo operator+( const foo &amp;lhs, const foo &amp;rhs );
  </code></pre>
  
  <p>So, is it standard to use one version over the other?  Are there situations where you would be forced into one version (This is only for adding the same object types)?  I'm not familiar with assembly language, but would the compiler convert these into the same list of instructions (This question is obviously dependent on answers to the first 2)?</p>