I saw both options being used in the SAME text today, so I googled it and found differences of opinion.
At the top of Google search was this theory:
The phrase "compared with" is used to compare similar things, while the phrase "compared to" is used to compare dissimilar things. [Expertsglobal.com]
I tested this theory using this BBC article about health trends.
Preply.com says the opposite (I've corrected their grammar so that it makes more sense but I still don't understand it):
"Compare to" expresses similarity between two things. e.g. I compare my work to that of Dickens. "Compare with" suggests that the differences between two things are at least as important as the similarities. (What??)
Both are ok and can be used interchangeably.