I've always said there seem to be three major factors in success, with hard work only being one of them: effort, opportunity, and luck.

Luck is just random chance -- happening to be in the right place at the right time is good luck, happening to be in the wrong place at the wrong time is bad luck.

Effort we all know about, as it's the one most rich people -- and people who buy into the myth of the American Dream -- focus on so hard they ignore the other two. It's just a matter of trying and putting in the work when necessary. This, by the way, is the only factor of the three a person has any individual control over, which is probably why successful people seem to have tunnel vision on it, as it makes their success seem entirely their own doing.

And lastly, opportunity. These are chances created for you by other people; it is what other people allow you to do, basically. Despite again the American Dream myth, not everyone has equal opportunities. For instance, straight white men have more opportunities in the Western world than anyone else; people born into rich families have more opportunities than people born into poverty; people who are naturally smarter or able-bodied or neurotypical all have more opportunities than others; etc. This one is quite important, but since it's controlled by other people, if a successful person acknowledges it, they then have to take responsibility for giving equal opportunities to other people, which might be why they often ignore the influence of opportunity in success.

For my own story, I'm middle class, possibly even upper middle class depending on relativity. (I'm certainly making more money than I ever imagined making just 5 years ago, coming from a lower-middle-class family.) But it would be entirely disingenuous to pretend that was all my doing, all my hard work, and nothing else that got me here. I can even pinpoint specific examples of each factor that led me here:

Luck: when I was struggling to find a career job out of college, barely getting by on a retail position that didn't pay enough to live on (I lived with my mom out of necessity at that point), tons of job listings were sent to my email every week, and one after another I saw jobs I didn't have the skills for. Then, scrolling through one listing from Indeed or Monster one day, I almost scrolled past a post for a position that required Angular knowledge, which I didn't have. But I stopped because the company name sounded familiar, and I remembered my mom had worked for them 20 years ago. Her job had nothing to do with my position, and I've never used her name (nor would anyone remember her if I did), but just the coincidence of happening to scroll past the only listing from a company my mom happened to work for decades ago convinced me to apply for, and ultimately be hired for, that job.

Opportunity: Oh, man, where do I start with this?

First, I was only able to get a degree from a prestigious university (within STEM, at least) because of scholarships and loans. There's no way in hell I'd have been able to pay tuition without them. Some of those loans I wasn't approved for, and extended family members with a better income and better credit co-signed to get them approved. Opportunities not everyone has. And if you don't think that's enough "opportunity" vs "something anyone can do", when I got to my last year at uni, I still couldn't afford the last bit of tuition, and my loan approvals had run dry, at which point my mom complained to the school and they gave a music scholarship to cover the rest... despite me being a comp sci major with no connection to music at all. That is definitely not anything I did, nor something that anyone can expect to get handed to them.

I also failed out of uni several times. First time, I attended classes at a local community college and then re-applied and got re-admitted back into uni. Second time, I had been diagnosed by the campus psych center with an anxiety and depressive disorder, and so at the last minute they put me on "psychological leave", ultimately wiping out my semester of failed classes and letting me re-apply again after a semester away. The third time, I was 1 semester of credits short of getting my degree, and one of my professors, who was the head of graduation requirements for the comp sci department, convinced a few higher-ups to bend the rules and accept transfer credits that I technically shouldn't have been allowed to transfer because I got a D in that class. That's the only reason I got my degree.

When I applied for my current job, I applied for an entry-level position. It was my first full-time job in the industry, and I just wanted my foot in the door. After my interview, I got a call saying "we'd rather hire you for a senior role for twice the salary; check the website, we just added that posting. Apply to it; it's just paperwork, you're already hired." Some might say I earned that through my skills, but since I applied for entry level, the company did not have any obligation to double my salary. They could have just said "you're hired" and saved themselves cash. They chose to do otherwise in my favor.

So I'm fully aware that a large amount of whatever success I have is due to opportunities that I didn't earn and was certainly not entitled to in the current Western society, that many people don't ever get. To pretend it was "all me" would be absolute hubris and dickishness.

Effort: I spent 20 years learning to code, though that was mostly for my own fulfillment. I persisted every time I failed out of college, as best I could. And I do my best work most of the time. I'm not discounting my efforts, I'm just keeping them in perspective.