When you prefer A over B = You like A more (than you like B)
'Would rather' is used in several ways.
Use 'would rather + infinitive' when making a difficult decision (because all the options available don't stand out to you), or when showing a preference for A over B.
I would rather be single than be in an abusive relationship.
It is also used to wish that something happened or happens.
‘would rather’ and ‘prefer’ can sometimes be used interchangeably.