There are many flaws in your code, but the one most likely to cause a crash is this line:
important_variable = another_var;
another_var
does not point anywhere that can be deleted. But important_variable
is made to point to the same place, and then is deleted in A
's constructor.
Your "solution" masks the problem, at the cost of a memory leak. When you do this
another_var = new Type(); important_variable = another_var;
the original dynamically allocated Type
object that important_variable
pointed to is lost.
Besides that, you need to follow the rule of three.