#include <iostream>

using namespace std;

struct smth
{
	template <int i> struct key_t {};
	
	int x; int get(key_t<1>) { return this->x; }
	double y; double get(key_t<2>) { return this->y; }
	
	template <int i> auto get() -> decltype (this->get(key_t<i>())) { return this->get(key_t<i>()); }
};

int main()
{
	smth s = {1, 2.5};
	
	cout << s.x << ' ' << s.y << endl;
	cout << s.get<1>() << ' ' << s.get<2>() << endl;
	
	return 0;
}