STL Ausgabe von list mit operator<&

Hallo,
ich habe mir diesen Testcode geschrieben. Ich kann jedoch auf diese Weise das Objekt test nicht ausgeben. Was mache ich da falsch.
Wer kann mir helfen.

Danke schon mal.

Karsten

#include
#include
#include
#include
using namespace std;

class test
{
public:
int inhalt;

int getInhalt() { return inhalt; }
/**
* overloaded operator returnes the path to stacktop
*/
friend ostream& operator coll1;
list coll2;

test var1, var2;
var1.inhalt = 10;
var2.inhalt = 20;

coll1.push_back(var1);
coll1.push_back(var2);
copy( coll1.begin(), coll1.end(), coll2.begin() );

copy( coll2.begin(), coll2.end(), ostream_iterator(cout, " "));

}

Hallo Karsten,

#include
#include
#include
#include
using namespace std;

class test
{
public:
int inhalt;

Wieso public?

int getInhalt() { return inhalt; }

Du musst die Methode const machen:
int getInhalt() const { return inhalt; }

/**
* overloaded operator returnes the path to stacktop
*/
friend ostream& operator