Output Operator Overloading ostream& operator<<(ostream &os, const List &list) { Node *c = list.head; if (c) { os << c.number; c = c->next; } for (; c; c = c->next) os << ' ' << c.number; return os; }