either the catholic church has contradicted itself, or unbaptized dead infants cannot enter heaven

Exceptions do not break the general rule. Particularly considering that the rules are given by God for men, not for Himself, this can't even be considered a breaking of the rules. If a father says that 8:30 is bedtime, he is not infringing his own rules if he stays up past that hour. Bedtime is for children, Sacraments are for us. In any case, it is not unheard of for this particular general rule to be "broken". The Good Thief, which tradition calls St. Dimas was not baptized, and could hardly be said to be condemned, as Jesus says to him he will enter Paradise with Him. On the insistence of His August Mother, Jesus turns water into wine "before his time". Miracles too, are exceptions to general rules. Just because God decides to resurrect Lazarus does not mean that dead people leave off dying.Technically speaking you are right about one thing. The idea that God is unrestrained by the Sacraments He instituted for our salvation can be applied to anything, including the idea that unrepentant unbelievers cannot be saved. Even, in fact, to the idea that unrepentant sinners in general, including war criminals or persecutors can in principle be saved. There is a difference, however, between those cases which makes it less probable that an exception will be made. In the case of the infants, the age of reason (generally thought to be at seven years) has not been reached, and therefore considering the leniency shown by Paul in Romans 2: 14-15 to those who do not know enough to be expected to even consider baptism (Indeed, when Gentiles, who do not have the law, do by nature things required by the law, they are a law for themselves, even though they do not have the law.) we can see that along with God's Justice goes His Mercy. So, we have a general rule, the fact that apart from the Saving Grace none can be saved, and that the Sacrament Instituted by God in order to give this Grace is Baptism. This leads to the obvious conclusion that, as a general rule, the unbaptized cannot enter heaven. This, however, must take into account that the Sacraments are gifts from God to his people, and not restraints to His Divine Freedom; that He freely given His Grace on occasion apart from these Sacraments (St. Dimas, the Holy Innocents, Cornelius...). This leads us to the position taken in the Catechism: that we know of no other means that assures salvation than Baptism, but we cannot discount these existing.This means that quotes of Church Fathers or Popes saying the unbaptized cannot be saved are true, as they underscore the general rule; and quotes by Church Fathers and Popes saying we must pray for them and trust God's mercy anyways are also true. What is not true, and is not the position of the Church, is that there is any assurance that they will be saved, and this is not what the Catechism is implying.ConclusionWe have seen that the supposed contradiction my opponent posited does not exist. The Catechism does not say unbaptized infants go to heaven as a general rule, but rather affirms the same rule that has been affirmed throughout Church history and reminds us that Sacraments bind us and not God, thereby also affirming the tradition of praying for them anyways and placing our hopes on Divine Mercy.