#include <iostream>
#include <sstream>
using namespace std;

class Log {
 public:
  Log() = default;
  Log(const Log&) = delete;

  ~Log() {
    cout << this << " dtor" << endl;
    cout << stream_.str() << endl;
  }

  template <class T>
  Log& operator<<(const T& info) {
    cout << this << " <<" << endl;
    stream_ << info;
    return *this;
  }

 private:
  stringstream stream_;
};

int main() {
	[] {
	  Log log;
	  log << "A";
	  return log;
	} () << "B";
	
	return 0;
}