title: ambiguous overload in big numbers class
body: <p>I am building a big number class and I am facing a problem that I can't solve on my own.</p>
  <p>First of all, the class looks like this:</p>
  <pre><code>class bigNumber{
  private:
      char v[BNmaxLength];
      int L;
      void setll(long long int);
      int comp(bigNumber);
      void erase0();
      void mult10(int);
      void div10(int);
  public:
      bigNumber(){
          setll(0);
      }
      bigNumber(long long int q){
          setll(q);
      }
      bigNumber operator=(long long int);
      operator int();
      bool operator==(bigNumber);
      bool operator!=(bigNumber);
      bool operator&lt;(bigNumber);
      bool operator&lt;=(bigNumber);
      bool operator&gt;(bigNumber);
      bool operator&gt;=(bigNumber);
      bigNumber operator+(bigNumber);
      bigNumber operator+=(bigNumber);
      bigNumber&amp; operator++();
      bigNumber operator++(int);
      bigNumber operator-(bigNumber);
      bigNumber operator-=(bigNumber);
      bigNumber&amp; operator--();
      bigNumber operator--(int);
      bigNumber operator*(long long int);
      bigNumber operator*=(long long int);
      friend std::istream&amp; operator&gt;&gt;(std::istream&amp;, bigNumber&amp;);
      friend std::ostream&amp; operator&lt;&lt;(std::ostream&amp;, bigNumber);
  };
  </code></pre>
  <p>And I wanted to be able to write something like this:</p>
  <pre><code>bigNumber b=276743;
  int a;
  a=b;
  </code></pre>
  <p>so I overloaded the typecasting operator from bigNumber to int by doing so:</p>
  <pre><code>bigNumber::operator int(){
      int a=0;
      for(int i=L;i&gt;=1;--i){
          a*=10;
          a+=v[i];
      }
      return a;
  };
  </code></pre>
  <p>but then if I type</p>
  <pre><code>bigNumber b=276743;
  int a=34672;
  cout&lt;&lt;(b&lt;a);
  </code></pre>
  <p>it displays this error:</p>
  <blockquote>
  <p>ambiguous overload for 'operator&lt;' (operand types are 'bigNumber' and 'int')</p>
  <p>note: candidates are:</p>
  <p>note: operator&lt;(int, int) </p>
  <p>note: bool bigNumber::operator&lt;(bigNumber)</p>
  </blockquote>
  <p>How can I typecast the bigNumber class in order to:</p>
  <ol>
  <li><p>not get this error anymore</p>
  </li>
  <li><p>not use explicit type casting</p>
  </li>
  <li><p>always convert the int to bigNumber in order to not lose precision (I observe that it's not doing this when I write <code>a&lt;b</code>)</p>
  </li>
  </ol>