#include <iostream>
class MyLogger {
public:
MyLogger(std::ostream& logStream)
: logStream_(logStream)
{}
template<typename T>
friend MyLogger& operator<<(MyLogger&, const T&);
private:
std::ostream& logStream_;
};
template<typename T>
MyLogger& operator<<(MyLogger& log, const T& value) {
log.logStream_ << value;
return log;
}
int main() {
MyLogger log(std::cout);
log << "Hello" << " World!";
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgTXlMb2dnZXIgewpwdWJsaWM6CiAgICBNeUxvZ2dlcihzdGQ6Om9zdHJlYW0mIGxvZ1N0cmVhbSkgCiAgICA6IGxvZ1N0cmVhbV8obG9nU3RyZWFtKQogICAge30KCiAgICB0ZW1wbGF0ZTx0eXBlbmFtZSBUPgogICAgZnJpZW5kIE15TG9nZ2VyJiBvcGVyYXRvcjw8KE15TG9nZ2VyJiwgY29uc3QgVCYpOwpwcml2YXRlOgogICAgc3RkOjpvc3RyZWFtJiAgbG9nU3RyZWFtXzsKfTsKCnRlbXBsYXRlPHR5cGVuYW1lIFQ+Ck15TG9nZ2VyJiBvcGVyYXRvcjw8KE15TG9nZ2VyJiBsb2csIGNvbnN0IFQmIHZhbHVlKSB7CiAgICBsb2cubG9nU3RyZWFtXyA8PCB2YWx1ZTsKICAgIHJldHVybiBsb2c7Cn0KCmludCBtYWluKCkgewogICAgTXlMb2dnZXIgbG9nKHN0ZDo6Y291dCk7CgogICAgbG9nIDw8ICJIZWxsbyIgPDwgIiBXb3JsZCEiOwp9Cg==