changed print to add ostream parameter