std::ostreamIt has many overloads operator<<, including both of the following:
std::ostream& operator<<(std::ostream&, const char*);
std::ostream& operator<<(std::ostream&, int);
Your class testcan be converted both to const char*and to int. The compiler cannot choose which transform to use, since both transforms will work equally well. Thus, the conversion is ambiguous.
source
share