If you change your function declaration like so it should work:
void function(Object * &obj)
In your original code, you were passing the pointer by value which means the function made a copy of the pointer and any changes to the pointer in the function would not be reflected. When you pass by reference you are actually working on the original data, this could potentially be done behind the scenes using pointers.