In the following sentence, I like having several friends compared to having only one or two good friends. the -ing word following compared to is a gerund, that is an -ing word functioning as a noun.
The first two examples come from Just the Word
Everything was boring compared to the books he read.
Well it was useless compared to the amount I'd been using.
Or this sentence from the concordancer on Lexical Tutor:
Also, it requires more time as compared to the automatic approach.
The common pattern for compared to is that it is followed by a noun or noun phrase. I did not find any infinitive, that is to + the simple form of the verb in my searches.
In the future, I will keep these examples in mind and warn that the pattern of to + the simple form of the verb usually holds true.