Don't make data members public within a class. Make them private (or protected) and then overload the input operator.