Suppose you have a family of type-unrelated classes implementing a common concept by means of a given method returning a value:
class A { public: int val() const
You can use return-type SFINAE:
template auto val_of(const T& t) -> decltype(std::declval().val()) { return t.val(); } int val_of(...) { return 0; }