The Connection between Out-of-Distribution Generalization and Privacy of ML Models