title: Operator Overloading: Simple Addition... error C2677: binary '+': no global operator found with takes type ___ (or there is not acceptable conversion)
body: <p>Here is my header:</p>
  
  <pre><code>//RINT.h
  #ifndef _RINT_H_
  #define _RINT_H_
  
  #include &lt;iostream&gt;
  
  class RINT
  {
      public:
          RINT();
          RINT(int);
          RINT(int, int);
          RINT operator+(RINT);
          RINT operator+(int);
          RINT operator+();
          friend std::ostream &amp;operator&lt;&lt;(std::ostream &amp;, const RINT &amp;);
          friend std::istream &amp;operator&gt;&gt;(std::istream &amp;, RINT &amp;);
      private:
          int a, b;
  };
  
  #endif
  </code></pre>
  
  <p>And the definitions: </p>
  
  <pre><code>//RINT.cpp
  #include &lt;iostream&gt;
  using namespace std;
  
  #include "RINT_stack.h"
  
  RINT::RINT()
  {
      a = b = 0;
  }
  
  RINT::RINT(int x)
  {
      a = x;
      b = 0;
  }
  
  RINT::RINT(int x, int y)
  {
      a = x;
      b = y;
  }
  
  RINT RINT::operator+(RINT x)
  {
      a += x.a;
      b += x.b;
      return RINT(a,b);
  }
  
  RINT RINT::operator+(int x)
  {
      a += x;
      return RINT(a,b);
  }
  
  RINT RINT::operator+()
  {
      return RINT(a,b);
  }
  
  ostream &amp;operator&lt;&lt;(ostream &amp;o, const RINT &amp;x)
  {
      o &lt;&lt; x.a;
      o &lt;&lt; x.b;
      return o;
  }
  
  istream &amp;operator&gt;&gt;(istream &amp;i, RINT &amp;x)
  {
      i &gt;&gt; x.a;
      i &gt;&gt; x.b;
      return i;
  }
  </code></pre>
  
  <p>And finally, the test code:</p>
  
  <pre><code>//RINT_test.cpp
  #include "stdafx.h"
  #include "RINT_stack.h"
  
  #include &lt;iostream&gt;
  using std::cin;
  using std::cout;
  using std::endl;
  
  int main()
  {
      RINT x, y = 4;
      int a = 5, b = 2;
      RINT z = y;
  
      x = 5;
      y = 6;
      z = x + y;
      z = x + 10;
      z = 1 + x; //error here!
      x = 1;
      x = +x;
  
      return 0;
  }
  </code></pre>
  
  <p>I'm receiving the following error in RINT_test.cpp on line 20 at 'z = 1 + x':</p>
  
  <p>error C2677: binary '+': no global operator found which takes type 'RINT' (or there is not acceptable converstion)</p>
  
  <p>I know that the error is coming in because the operator is preceded by an integer, but I'm not sure how to proceed from here. Any help or direction is appreciated. Thanks!</p>