it's better to write struct 'message' with friend input and output operations to incapsulate reading and writing