Made << operator override a friend function

other minor changes