cpp: Add ostream operators for key and uid