#include <iostream>
class A
{
public:
const A& foo(int x) const { return *this; }
const A& operator<<(int x) const { return *this; }
};
int f(int x)
{
std::cout << x << std::endl;
return x;
}
int main()
{
A a;
a.foo(f(1)).foo(f(2)).foo(f(3));
a << f(4) << f(5) << f(6);
}