have your cake and eat it (too)
dictionary.cambridge.org
to do or get two good things at the same time, esp. things that are not usually possible to have together:
I worked at home so I could raise my family and still earn money – I guess I wanted to have my cake and eat it too. to have or do two good things at the same time that are impossible to have or