title: Overloading an input operator
body: <p>Currently have a assignment in which I've to create my own BigInt class. The issue I'm having is that I'm not sure how I would be able to overload the input operator the same way I've overloaded =.</p>
  <p>My header file is as follows:</p>
  <pre><code>#ifndef BIGINT_BIGINT_H
  #define BIGINT_BIGINT_H
  
  #include &lt;iostream&gt;
  
  #define BIGINT_SIZE 256
  
  class Bigint {
      public:
          friend std::ostream&amp; operator&gt;&gt; (std::ostream&amp; out, const Bigint&amp; n);
  
          friend std::ostream&amp; operator&lt;&lt; (std::ostream&amp; out, const Bigint&amp; n);
  
          // the binary + operator
          Bigint operator+ (const Bigint&amp; n);
  
          // the binary - operator
          Bigint operator- (const Bigint&amp; n);
  
          // the binary * operator
          Bigint operator* (const Bigint&amp; n);
  
          // the binary / operator
          Bigint operator/ (const Bigint&amp; n);
  
          // the binary = operator:   bigint = bigint
          Bigint&amp; operator= (const Bigint&amp; n);
  
          // the binary = operator with int:   bigint = int
          Bigint&amp; operator= (int n);
  
          // the constructor and destructor
          Bigint(int size = BIGINT_SIZE) {digits = size; number = new char[digits]; }
  
          ~Bigint() { delete[] number; }
  
  
      private:
          int  digits;
          char *number;
  };
  
  
  #endif //BIGINT_BIGINT_H
  </code></pre>
  <p>And my cpp file is:</p>
  <pre><code>#include &quot;Bigint.h&quot;
  #include &lt;iostream&gt;
  
  
  std::istream&amp; operator&gt;&gt; () {
  
  }
  
  
  std::ostream&amp; operator&lt;&lt; (std::ostream&amp; out, const Bigint&amp; n) {
      int cntr = 0;
  
      while ((n.number[cntr] == 0) &amp;&amp; (cntr &lt; n.digits-1))
          cntr++;
  
          while (cntr &lt; n.digits)
              out &lt;&lt; (int)n.number[cntr++];
  
              return out;
  }
  
  
  Bigint&amp; Bigint::operator= (int n) {
      int cntr;
  
      cntr = digits - 1;
      while (cntr &gt;= 0) {
          number[cntr--] = n % 10;
          n /= 10;
      }
  
      return *this;
  }
  
  Bigint Bigint::operator+ (const Bigint&amp; n) {
      Bigint sum( (digits &gt; n.digits) ? digits : n.digits );
      int nptr, myptr, sumptr;
      char next_n1, next_n2;
      char carry = 0;
  
      for (sumptr = sum.digits - 1, myptr = digits - 1, nptr = n.digits - 1; sumptr &gt;= 0; sumptr--, myptr--, nptr--) {
          next_n1 = (nptr &lt; 0) ? 0 : n.number[nptr];
          next_n2 = (myptr &lt; 0) ? 0 : number[myptr];
          sum.number[sumptr] = next_n1 + next_n2 + carry;
          if (sum.number[sumptr] &gt; 9) {
              carry = 1;
              sum.number[sumptr] -= 10;
          }
          else{
              carry = 0;
          }
      }
  
      return sum;
  }
  </code></pre>
  <p>I've only actually implemented code to handle the + and = so far.</p>