#include <iostream>

template<typename T, int (T::*M)>
int getValue(T const& obj)
{
    return obj.*M;
}

class NotPlainOldDataType
{
public:
    explicit NotPlainOldDataType(int xx) : x(xx) { }
    ~NotPlainOldDataType() { }
    int x;
};

int main()
{
    typedef NotPlainOldDataType NPOD;

    NPOD obj(3);
    std::cout << getValue<NPOD, &NPOD::x>(obj) << '\n';
}