You need to take the address of the object:
#include <memory>
os.write(reinterpret_cast<char const *>(std::addressof(obj)), sizeof(Type));
// ^^^^^^^^^^^^^^^^^^^
In a crunch you can also say &obj
, but that's not safe in the presence of an overloaded operator&
.