Typically, the comparison occurs within one of the two following scenarios:
1) "I write my characters in a way reminiscent of Stephen King's IT, who are facing plot twists like those found in a Paula Hawkins novel."
2) "How is it that (insert any published, top-selling author's name here) has an agent and I don't?"
The first scenario is problematic because it shows the writer doesn't understand the market of the novel he/she has written. Stephen King's IT is Horror with a supernatural bent while Paula Hawkins writes Psychological Thrillers. Other than being popular at the moment, these two books would not normally be found in the same section of the library or average book store.
Of course, it is important to know your genre, market, and where your novel would sit on the shelf, but it's more important to be true to yourself. Comparing your work to what's popular is a big risk that rarely pays off. If you write a Psychological Thriller, know the hallmarks and authors of that genre so you can give an accurate comparison if you must compare yourself at all. I also suggest using the phrase "influenced by" as opposed to making direct comparisons because you are unique, and so is your writing.
The second scenario is something I have heard a lot from frustrated authors, and I admit have said myself in moments of weakness. It's easy to chalk up someone else's success to who they know or luck, but the truth is successful authors have to deal with rejections and disappointments too. But they keep writing, revising, and pushing forward until they can break through to the other side. If writing a best-seller was easy, every writer on the planet would be a published success.
Besides, reading any bestseller and wondering how you don't have an agent or a million dollar contract is not a good use of your time. Reading is always something an author should be doing as much as possible, but wondering how another author is successful and you are not is not going to help you. And sometimes it can be like comparing your first book to another author's twentieth.
An established author has figured out who he/she is by this point, which you may still be doing; he/she has a strong fan base, which you may not; and he/she is farther along on the publishing pathway than most everyone else. No one else is going to have the exact same experience as you, and you are not going to have the exact same experience as anyone else. Making this type of comparison will only frustrate you and steal the joy you hopefully get from writing in the first place.
In closing, here is something important to keep in mind: most novels being published right this minute were selected by an agent for representation 1-2 years ago. ONE-to-TWO YEARS. Let that sink in. And let's not even talk about how long ago the novel being published today was written.
So, be patient, keep writing, and focus on being who YOU are as a writer - not anybody else.