Change ofstream which is passed to function