I have a problem with the << operator in C++. I need this operation work:
  cout << comp2 << comp1;
class Compo
{
    string name;
    int power;
    string app;
public:
    Compo(string s, string a, int p):name(s), power(p),app(a){};
    //~Compo();    
     string GetAsString()const{
        ostringstream oss;    
        oss << name << " [ " << power << " ] desc: " << app << endl;        
        return oss.str();
    };
     string &operator<<(Compo& aux)const{               
        return aux.GetAsString();
    };
};
void main()
{
    Compo comp1("Pencil","Best",12);
    Compo comp2("Notes","Not Best",22);
    cout << comp2 << comp1;        
    cin.get();
}
i have erro on cout << comp2
the error description is,
error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'Compo' (or there is no acceptable conversion)
and one warn alert,
returning address of local variable or temporary
ho i need change to this works.
 
     
     
     
     
    