make c++ object weak