Public class member or method that returns a reference to a private member?
What are the difference between a public class member

    class data
    {
    public:
     
        std::list<data> list_of_data;
    };

And a method that returns a private member as reference?

    class data
    {
    public:

       std::list<data>& get_data()
       { return list_of_data; }

    private:
     
        std::list<data> list_of_data;
    };

Which one is better?
Public class member or method that returns a reference to a private member?
===

What are the difference between a public class member

    class data
    {
    public:
     
        std::list<data> list_of_data;
    };

And a method that returns a private member as reference?

    class data
    {
    public:

       std::list<data>& get_data()
       { return list_of_data; }

    private:
     
        std::list<data> list_of_data;
    };

Which one is better?