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

class Foo {
public:
  template <typename Type> Type get();

private:
  int value = 10;
};

template <> int Foo::get() { return value; }
template <> string Foo::get() { return to_string(value); }

class Bar {
public:
  template <typename Type> Type get();

private:
  int value = 15;
};

template <> int Bar::get() { return value; }
template <> string Bar::get() { return to_string(value); }

class Elo {
public:
  template <typename Type, typename F> Type get();

private:
  Foo foo;
  Bar bar;
};

template <> int Elo::get<int, Foo>() { return foo.get<int>(); }
template <> string Elo::get<string, Foo>() { return foo.get<string>(); }
template <> int Elo::get<int, Bar>() { return bar.get<int>(); }
template <> string Elo::get<string, Bar>() { return bar.get<string>(); }

int main() {
  Elo e;
  cout << e.get<int, Foo>() << endl;
  cout << e.get<int, Bar>() << endl;
  cout << e.get<string, Foo>() << endl;
  cout << e.get<string, Bar>() << endl;
  // cout<<e.get<int,Elo>()<<endl; blad kompilacji
  return 0;
}