c++ – Replace references storage with std::shared_ptr and std::weak_ptr

I have a simple case where I know things can go wrong if I start to use threads. Godbolt here

#include <iostream>
#include <memory>

class team;

class member
{
    public:
    member(team& my_team) : my_team(my_team) {
        std::cout << "ctor" << std::endl;
    }

    ~member(){
        std::cout << "dtor" << std::endl;
    }

    void modify_my_team()
    {
        //here I want to make sure team is still a valid reference
    }

    private:
    team& my_team;
};

class team
{
    member m1{*this};
    member m2{*this};
    member m3{*this};
};

int main()
{
    team t;
    return 0;
}
  1. In this example, I want to remove the reference to team in the member class. I think I could use std::shared_ptr and std::weak_ptr. What’s the safest way to do this?
  2. Is it always bad to store a reference?