Overload output operator in a enum in C++
<p>Its posible to overload the output operator inside an enum ? I'm getting all sort of errors(if I use class, I dont get any):</p>

<pre><code>   ../src/oop.cpp:18:2: error: expected identifier before 'friend'
    ../src/oop.cpp:18:2: error: expected '}' before 'friend'
    ../src/oop.cpp:18:2: error: 'friend' used outside of class
    ../src/oop.cpp:18:16: error: expected initializer before '&amp;' token
    ../src/oop.cpp:22:1: error: expected declaration before '}' token
</code></pre>

<p>I'm after to implement something like this(java code):</p>

<pre><code>public enum Type { 

  ACOUSTIC, ELECTRIC;

  public String toString() {
    switch(this) {
      case ACOUSTIC: return "acoustic";
      case ELECTRIC: return "electric";
      default:       return "unspecified";
    }
  }
}
</code></pre>

<p>Thank you.  </p>

<p>edit:  </p>

<pre><code>enum Type {
    //ACOUSTIC, ELECTRIC;
    inline std::ostream&amp; operator &lt;&lt; (std::ostream&amp; os, Type t) // error here
    {

    }
};
</code></pre>
