Q: Vector of objects that contains a pointer to another object C++ I have the class state_t with a pointer to a parent node of the same type
class state_t{
    public : 
        int pos_bus, cost;
        map<int, vector<int>> kids_waiting;
        vector<int> kids_bus;
        state_t* parent;
        int g, f;

        state_t(int _pos_bus, vector<int> _kids_bus, map<int, vector<int>> _kids_waiting) {
            pos_bus = _pos_bus;
            kids_bus = _kids_bus;
            kids_waiting = _kids_waiting;
            g = 0;
            f = 0;
        };

        state_t() {};
        state_t(state_t *parent_){
            parent = parent_;
            pos_bus = parent_->pos_bus;
            kids_bus = parent_->kids_bus;
            kids_waiting = parent_->kids_waiting;
            f = parent_->f;
            g = parent_->g;
        };

The first constructor is only used for the first state_t object, the next ones will be created with the third constructor. Then i also have a vector<state_t>, when I generate new nodes I can print it and view that their parent pointer is what it should be, but after pushing it to a vector it changes it values.
In the following code:
void astar::solve(problem_t problem){
    state_t current = problem.initial_state;
    bool success = false;

    //We put the initial state in the opened list
    open.push_back(current);

    //while the list is not empty and no solution is found
    while(!success && !open.empty()){
        //we get the last element of the opened list
        current = open.back();


        //we erase it from the opened list
        open.pop_back();
        //we add the state itself to the closed list
        closed.push_back(current);

        for(state_t succesor : problem.getSuccesors(current)){
            if(!in(succesor, closed) ){
                open.push_back(succesor);
                //IF I MAKE PRINT OF PARENT HERE
                 succesor.print();
                 succesor.parent->print();
            }
        }      

         // IF I PRINT HERE
         current.print();
         current.parent->print();
    }
}

In the first one I get the expected value:
CHILD NODE: <1, <  >, [2]: < 3 4 >  >
f: 0g: 8
PARENT NODE: <0, <  >, [2]: < 3 4 >  >

In the second parent is the same as child:
CHILD NODE: <0, <  >,  >
f: 0g: 92
PARENT NODE: <0, <  >,  >
f: 0g: 92

