I would contest the "very comfortable" part. For one thing, the training and education a doctor has to go through is an order of magnitude more intense - and it is expensive as hell[1]. For another, after med school doctors continue to work like crazy. My parents, who are in their late 50s and early 60s, still work 12 hours a day on a regular basis, and have to consume entire journals/periodicals and travel for international conferences just to stay on top of new things.
Among the hundred or more doctors I personally know of among my family's circle of friends and acquaintences, only one or two live "comfortably," by working a few days a week and making a ton of money. But that's because they:
a) have hyper-specialized so that they are one of the few experts in their sub-field b) live in a geographic area where they can charge a ton for their services
Compared to this, a software engineer making a low six figure salary lives a very comfortable life. AND software is much less location-dependent, since you can work remotely (unlike doctors).
[1]A software engineer goes to college for four years and then gets a job as a programmer. In stark contrast, a doctor though has to do four years of undergrad, four years of med school after that, and then three to seven years of residency. If they want to become highly specialized? Two to three years of fellowship after residency.