#include <functional>
#include <iostream>
int main()
{
std::function<int(int)> f = [](int x) { return x; };
std::function<const int&(const int& x)> g = f;
std::cout << g( 42 ) << std::endl;
}
I2luY2x1ZGUgPGZ1bmN0aW9uYWw+CiNpbmNsdWRlIDxpb3N0cmVhbT4KaW50IG1haW4oKQp7CiAgICBzdGQ6OmZ1bmN0aW9uPGludChpbnQpPiBmID0gW10oaW50IHgpIHsgcmV0dXJuIHg7IH07CiAgICBzdGQ6OmZ1bmN0aW9uPGNvbnN0IGludCYoY29uc3QgaW50JiB4KT4gZyA9IGY7CiAgICBzdGQ6OmNvdXQgPDwgZyggNDIgKSA8PCBzdGQ6OmVuZGw7Cn0=