title: C++ ambiguous overload for ‘operator ’
body: <p>I'v read several posts here about this kind of errors, but I wasn't able to solve this one...
  Has soon I define the operator int and the function f, fails to compile. 
  I tested several things by I wasn't able to solve the issue....
  Thanks</p>
  
  <pre><code>ex1.cpp: In function ‘int main(int, char**)’:
  ex1.cpp:35:13: error: ambiguous overload for ‘operator+’ in ‘a + 4’
  ex1.cpp:35:13: note: candidates are:
  ex1.cpp:35:13: note: operator+(int, int) &lt;built-in&gt;
  In file included from ex1.cpp:3:0:
  Fraccao.h:41:9: note: Fraccao operator+(const Fraccao&amp;, const Fraccao&amp;)
  ex1.cpp:38:13: error: ambiguous overload for ‘operator+’ in ‘4 + a’
  ex1.cpp:38:13: note: candidates are:
  ex1.cpp:38:13: note: operator+(int, int) &lt;built-in&gt;
  In file included from ex1.cpp:3:0:
  Fraccao.h:41:9: note: Fraccao operator+(const Fraccao&amp;, const Fraccao&amp;)
  </code></pre>
  
  <p>The class:</p>
  
  <pre><code>class Fraccao {
      int numerador;
      int denominador;
  
  public:
      Fraccao(int num = 0, int deno = 1) : numerador(num), denominador(deno) {}
  
      Fraccao &amp; operator+=(const Fraccao &amp;fra);
  
      Fraccao &amp; operator*=(const Fraccao &amp;fra);
  
      operator int() const;
  
      const Fraccao &amp; operator++();
      const Fraccao operator++(int);
  
      string getAsString() const;
  };
  
  Fraccao operator +(const Fraccao &amp;a, const Fraccao &amp;b);
  ostream &amp; operator&lt;&lt;(ostream &amp; saida, const Fraccao &amp; fra);
  </code></pre>
  
  <p>And on my main:</p>
  
  <pre><code>void func(int n) {
      cout &lt;&lt; n; // 
  }
  
  int main(int argc, char** argv) {
      //...
      d = a + b;
      const Fraccao h(7, 3);
      func(h);
  
      return 0;
  }
  </code></pre>