// ============== File Item.h: #ifndef _Item_H #define _Item_H # include namespace misc { class Item { public: Item(int n) : _n(n) {} private: const int _n; friend std::ostream &operator << (std::ostream&, const Item&); }; }; // end namespace misc #endif /* _Item_H */ // ============== File Item.cc: # include "Item.h" std::ostream &operator << (std::ostream &os, const misc::Item &item) { return (os << '[' << item._n << ']'); };