How do I overload the addition operator to preform commutative calculation?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1188566/operator-overloading-in-c-as-int-obj">Operator Overloading in C++ as int + obj</a>  </p>
</blockquote>



<p>I have a class <code>A</code> with an overloaded <code>operator+</code>. My problem is that I wish to be able to use summation in the two following ways.</p>

<pre><code>A a;

a + 5;
</code></pre>

<p>and</p>

<pre><code>5 + a;
</code></pre>

<p>How do I overload <code>+</code> to be able to do this? I am aware that we can overload <code>++</code> to perform both post and pre increment (<code>++x</code> and <code>x++</code>), so how can I simulate the above ability as well?</p>
