It would depend on the way they were making the comparison. As someone with three grown kids, and someone who has had my share of long-time pets; I've seen that there are a lot of things that are the same with both. For example, if you talk to your child and/or talk to your pet; and if you're kind and respectful to either or both; both a child and a pet will generally turn out better, and so will the relationship with either.
Something else that's the same is realizing that if/when we take on either a child or pet in our lives, it's a matter of not always being able to not-do some things they need just because (for example) we're tired or don't feel like it.
People who are good with pets and good with children tend to know that there are those ways (beyond just what I mentioned above) in which raising either or both can be similar.
Having said that, though, I think (as in the case of what onegoodwoman said) it's HUGELY OFFENSIVE for anyone to ever compare (even the genuine and "legitimate") grief of losing a pet with something as horrible as losing a child.
Again, whether I'd be annoyed or not would depend on how the comparison between the two was being made. (Sometimes, however, one person may be "coming from a place" that the other doesn't understand; so lots of times (when the remark/comment is less extreme than the kind onegoodwoman mentioned) people get offended by stuff only because they misinterpret the context within which the remark was made).