C++: operator<< overloading in the nested classes
问题 This question has a detailed answer here: Overloading operator<<: cannot bind lvalue to ‘std::basic_ostream<char>&&’ I am trying to overload a nested subclass, and spent an hour trying to overload operator<< . Researched a little here, but still couldn't resolve it. Any help? :) Whenever I try compiling it using g++ -std=c++11 -lm -ggdb -g -O0 -Wall p_7_1.cpp -o p_7_1 , it gives me an error: Undefined symbols for architecture x86_64: "operator<<(std::__1::basic_ostream<char, std::__1::char