It seems obvious you should always declare data members private. But sometimes you may violate this rule without realizing it. Defining data members private is all about encapsulation.
If you hide your data members from your clients, you can ensure that class invariants are always maintained, because only member functions can affect them. Further-more, you reserve the right to change your implementation decisions later. If you don’t hide such decisions, you’ll soon find that even if you own the source code to a class, your ability to change anything public is extremely restricted, because too much client code will be broken. Public means unencapsulated, and practically speaking, unencapsulated means unchangeable, especially for classes that are widely used.
Generally speaking, you should restrict as much as possible for accessing data members. Fewer public data members, better encapsulation it is.