Compare and contrast have different meanings. Do not use compare as a synonym of contrast.
We compare things of the same kind or class. For example, we can compare an orange with another orange, but we cannot compare an orange with an apple.
- Compare the size of these two mangoes.
- How does your new car compare with your old one?
We contrast things of different classes or kinds.
- How does living in a house contrast with living in an apartment?
- Contrast the size of the mango and the pumpkin.