struct X
{
    int data1, data2;
    int X::*ptr;

    X() : ptr(&X::data1) {}
};

int main()
{
    X a;      // now, `a.ptr` points to `a.data1`
    X b = a;  //      `b.ptr` points to `b.data1`

    a.ptr = &X::data2;  // now `a.ptr` points to `a.data2`
                        //     `b.ptr` points to `b.data1`
    b = a;              //     `b.ptr` points to `b.data2` too

    // Usage hint:
    int deref = a.*(a.ptr); // gets the field pointed to by a.ptr, from the instance a
        deref = b.*(b.ptr); // gets the field pointed to by b.ptr, from the instance b

    // but of course you could get fancy and do
        deref = a.*(b.ptr); // gets the field pointed to by b.ptr, **but** from the instance a
}