class LongDouble { public: LongDouble (double dv) : _dv(dv){} double get() const { return _dv; } private: double _dv; };
template
template
template
std::ostream& operator«(std::ostream& os, const LongDouble& obj) { os « obj.get(); return os; }
int main(){
LongDouble ld(56.56);
Queue<LongDouble> list;
list.push(ld);
list.pop();
list.pop();
return 0; } ``` In the expression ``` std::cout << "value poped out: " << list.back() << "\n"; ``` `list.back()` is of type `T`, and its actual type is unknown until the member function `pop()` is instantiated. The `operator<<()` chosen depends on the actual type of `list.back()`, that is, on the type with which the template parameter `T` is replaced. It is therefore impossible to know which `operator<<()` is called until `pop()` is instantiated.