I have a std::vector with objects of the class Actor
std::vector<Actor>  actors(9);
I need to create a method which takes a single input parameter. The method should find the right Actor object in the Vector and return a reference to it. This reference will later be used by the callee to update the Object. I've tried to do this through
Actor& get_actor_ref_from_ped(Ped ped) {
    for (int i = 0; i < actors.size(); i++) {
        if (actors[i].isActorThisPed(ped)) {
            return actors[i];
        }
    }
    /* same issue with this approach
    for (auto &actor : actors) {
        if (actor.isActorThisPed(ped)) {
            return actor;
        }
    }*/
    //return null Actor
    return Actor::Actor();
}
However, when I try to update the Actor reference from another object, it behaves as if it was copied by value. Here is an example code. actor.hasSpotLight() is 1, but all vectorActor.hasSpotLight() are 0
void action_next_spot_light() {
    Actor actor = get_actor_ref_from_ped(PLAYER::PLAYER_PED_ID());
    if (actor.isNullActor() == false) {
        if (actor.hasSpotLight()==false) {
            actor.setHasSpotLight(true);
            log_to_file("actor.hasSpotLight() after " + std::to_string(actor.hasSpotLight()));
            for (auto &vectorActor : actors) {
                log_to_file("vectorActor.hasSpotLight() after " + std::to_string(vectorActor.hasSpotLight()));
            }
        }
    }
}
What am I missing?
 
     
    