title: Why pass by const reference in overload operator+ with multiple parameters
body: <p>I am doing operator+ overloading with multiple parameters as below.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  class Integer{
      int value;
      public:
          Integer(int i) {value=i;};
          int getValue() { return value;};
          friend Integer operator+ (Integer &amp; a, Integer &amp; b){
              Integer I (a.value+b.value);
              return I;
          };
  };
  
  int main() {
      Integer a(1), b(2), c(3);
      Integer d = a+b+c;
      cout&lt;&lt;d.getValue()&lt;&lt;endl;
      return 0;
  }
  </code></pre>
  
  <p>It can't be compile and return" no match for operator+". I read and understand the algorithm of multiple parameter that ((a+b)+c). Why it does not work?
  However, I found two ways to make it work:</p>
  
  <pre><code>friend Integer operator+ (const Integer &amp; a,const Integer &amp; b){
      Integer I (a.value+b.value);
      return I;
  };
  </code></pre>
  
  <p>And</p>
  
  <pre><code>friend Integer &amp; operator+ (Integer &amp; a,Integer &amp; b){
      Integer I (a.value+b.value);
      return I;
  };
  </code></pre>
  
  <p>But I dont know why. Thank you </p>