title: Why does my code need <iostream>?
body: <p>I wrote some basic code I learned that can be used to define a type that gets an enumerated value as its constructor argument and has a member function <code>AsString()</code> that returns the value as a string. </p>
  
  <p>The code doesn't compile unless I include <code>&lt;iostream&gt;</code>. It displays a warning in <code>main</code> saying that the type <code>color</code> has not been declared. Why is it required to include an input/output header file in my code while no input/output functions or operators are used in it? </p>
  
  <pre><code>enum ColorEnum {blue, red};
  
  class color
  {
      protected:
          ColorEnum value;
      public:
          color(ColorEnum initvalue)
          {
              value = initvalue;
          }
          std::string AsString()
          {
              switch (value)
              {
                  case blue:
                      return "blue";
                  case red:
                      return "red";
                  default:
                      return "N/A";
              }
          }
  };
  
  int main()
  {
      color mycolor = blue;
      return 0;
  }
  </code></pre>