To cast, you need to rethink the variable reference as an array reference:
reinterpret_cast<int(&)[3]>(x);
Keep in mind that using this gives undefined behavior; it will probably work on any reasonable implementation, but there is no guarantee that there will be no indentation between class members, while arrays are not padded.
source share