#include <iostream>
#include <memory>
#include <cstring>

struct A
{
  std::unique_ptr<int> up_myInt;
  A(int val)
  :
    up_myInt(std::make_unique<int>(val))
  {}
};

int main()
{
	A a(1);
	{
	  A b(2);
	  memcpy(&a, &b, sizeof(A));
	  std::cout << *a.up_myInt << std::endl;
	  //b gets deleted, and the memory b.up_myInt points to is gone
	}
	std::cout << *a.up_myInt << std::endl;
	return 0;
}