title: Error where no default constructor exists for a class
body: <p>I'm working on a program that is supposed to parse a command-line input, read an input text file, and then execute the sequence of steps specified from the test file.</p>
  
  <p>After working on the tokenizer class for some time, I've hit a wall, namely an error, that I'm not really sure how to solve. </p>
  
  <p>So, I have Tokenizer.h:</p>
  
  <pre><code>#ifndef _TOKENIZER_GUARD
  #define _TOKENIZER_GUARD 1
  #include &lt;string&gt;
  #include &lt;cstdlib&gt;
  #include &lt;climits&gt;
  #include &lt;cfloat&gt;
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  
  #include "Token.h"
  
  //
  // A class to create a sequence of tokens from an input file stream.
  //
  class Tokenizer
  {
      public:
          Tokenizer(const std::string&amp;, std::ostream&amp;);
          Tokenizer(Tokenizer&amp;); // Copy Constructor -I
          virtual ~Tokenizer();
  
          virtual int nextInt();
          virtual bool hasNextInt() const;
          virtual long nextLongInt();
          virtual bool hasNextLongInt() const;
          virtual float nextFloat();
          virtual bool hasNextFloat() const;
          virtual std::string next();
          virtual bool hasNext() const;
          Tokenizer&amp; operator= (Tokenizer&amp;); // overloaded equals operator
  
      protected:
  
      private:
          Tokenizer();
          std::ifstream stream;
          std::ostream _os;
          Token _token;
  };
  
  #endif
  </code></pre>
  
  <p>And Tokenizer.cpp:</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;cstdlib&gt;
  #include &lt;climits&gt;
  #include &lt;cfloat&gt;
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  
  #include "Tokenizer.h"
  
  Tokenizer::Tokenizer()
  {    //error occurs here
  
  }
  // Constructor 
  Tokenizer::Tokenizer(const std::string&amp; s, std::ostream&amp; o)
  {   //error occurs here
      stream.open(s);
      std::string t;
      getline(stream, t, ' ');
      _token = Token(t);
  }
  
  
  // Copy Constructor 
  Tokenizer::Tokenizer(Tokenizer&amp; t) :_token(t._token), stream(t.stream), _os(t._os)
  {
  
  }
  
  
  // Destructor
  Tokenizer::~Tokenizer()
  {
       stream.close();
  }
  
  // Saves current int to return, then moves _token to the next value 
  int Tokenizer::nextInt()
  {
      int temp = _token.toInteger();
      std::string t;
      getline(stream, t, ' ');
      _token = Token(t);
      return temp;
  }
  
  // Checks to see if there is a next value and if it is an int
  bool Tokenizer::hasNextInt() const
  {
      return _token.isInteger() &amp;&amp; hasNext();
  }
  
  // same as nextInt but long -I
  long Tokenizer::nextLongInt()
  {
      long temp = _token.toLongInteger();
      std::string t;
      getline(stream, t, ' ');
      _token = Token(t);
      return temp;
  }
  
  // same as hasNextInt but Long 
  bool Tokenizer::hasNextLongInt() const
  {
      return _token.isLongInteger() &amp;&amp; hasNext();
  }
  
  // same as nextInt but Float 
  float Tokenizer::nextFloat()
  {
      float temp = _token.toFloat();
      std::string t;
      getline(stream, t, ' ');
      _token = Token(t);
      return temp;
  }
  
  // same as hasNextInt but float 
  bool Tokenizer::hasNextFloat() const
  {
      return _token.isFloat() &amp;&amp; hasNext();
  }
  
  //Returns the next token 
  std::string Tokenizer::next()
  {
      std::string temp = _token.get();
      std::string t;
      getline(stream, t, ' ');
      _token = Token(t);
      return temp;
  }
  
  //True when it is not the end of the file
  bool Tokenizer::hasNext() const
  {
      return stream.eofbit != 1;
  }
  
  //Overloaded = operator 
  Tokenizer&amp; Tokenizer::operator= (Tokenizer&amp; t)
  {
      _token = t._token;
      stream = t.stream;
      _os = t._os; //error occurs here
  }
  </code></pre>
  
  <p>I get the error</p>
  
  <blockquote>
    <p>'std::basic_ostream>': no appropriate default >constructor available</p>
  </blockquote>
  
  <p>for the constructor. Later, when I use 'stream = t.stream' and '_os = t._os' I get the error</p>
  
  <blockquote>
    <p>function "std::basic_ostream&lt;_Elem, _Traits>::operator=(const >std::basic_ostream&lt;_Elem, _Traits>::_Myt &amp;) [with _Elem=char, >_Traits=std::char_traits]" (declared at line 85 of >"x:\Visual\VC\include\ostream") cannot be referenced -- it is a deleted >function  </p>
  </blockquote>
  
  <p>I've been trying to find some sort of solution for the first error, but I don't understand what's causing it. Creating a copy constructor was suggested to me, but it doesn't seem to have fixed the issue. I've also included Token.h below.</p>
  
  <pre><code>#ifndef _TOKEN_GUARD
  #define _TOKEN_GUARD 1
  
  #include &lt;string&gt;
  #include &lt;cstdlib&gt;
  #include &lt;climits&gt;
  #include &lt;cfloat&gt;
  
  //
  // Token class
  //
  class Token
  {
  public:
      Token(const std::string&amp; t) : _token(t) { }
  
      virtual std::string get() const { return _token; }
  
      virtual long toLongInteger() const;
      virtual bool isLongInteger() const;
      virtual int toInteger() const;  // for int and is int functions
      virtual bool isInteger() const; //
      virtual float toFloat() const;
      virtual bool isFloat() const;
      virtual bool isNonNumeric() const;
      Token() : _token("") {}
      std::string _token;
  protected:
  
  };
  
  #endif
  </code></pre>
  
  <p>I apologize in advance if I'm being too vague or something along those lines. I'm more than happy to provide anything else needed (since I'm stuck at the moment). </p>