After spending his days teaching AP American history and economics at the public Live Oak High School in San Jose, Calif., Matt Barry drives for Uber.

Barry’s wife, Nicole, teaches as well — they each earn $69,000, a combined salary that not long ago was enough to afford a comfortable family life. But due to the astronomical costs in his area, including real estate — a 1,500-square-foot “starter home” costs $680,000 — driving for Uber was a necessity.

“Teachers are killing themselves,” Barry says in the new book, “Squeezed: Why Our Families Can’t Afford America” (Ecco), out Tuesday. “I shouldn’t be having to drive Uber at eight o’clock at night on a weekday. I just shut down from the mental toll: grading papers between rides, thinking of what I could be doing instead of driving — like creating a curriculum.”

In her book, author Alissa Quart lays out how America’s middle class is being wiped out by the cost of living far outpacing salaries while a slew of traditionally secure professions — like teaching — can no longer guarantee a stable enough income to clothe and feed a family.

“Middle-class life is now 30 percent more expensive than it was 20 years ago,” Quart writes, citing the costs of housing, education, health care and child care in particular. “In some cases the cost of daily life over the last 20 years has doubled.”

In one of her book’s many striking findings, Quart writes that according to a Pew study, “Before the 2008 crash, only one-quarter of Americans viewed themselves as lower class or lower-middle class. No longer. After the recession of 2008 . . . a full 40 percent of Americans viewed themselves as being at the bottom of the pyramid.”

One of the book’s main messages, therefore, is that people finding it impossible to make ends meet shouldn’t blame themselves. It’s the system, she says, that’s broken.

“The main problem is a basic lack of a 21st century safety net for families,” Quart tells The Post, offering the cost of day care as just one example.

“In Montreal,” where day care is government subsidized, it costs “$7 to $20 a day. That makes a huge difference for families.” Figured annually for 50 weeks a year, five days a week, people in Montreal pay $1,750 to $5,000 per year on child care.

By comparison, Quart says that here, “many of the families I spoke to, who were ostensibly middle class, were spending around 20 to 30 percent of their income on day care.” Annual averages in the US range from “$10,468 for a center-based child-care program to $28,905 for a nanny.” According to the Economic Policy Institute, the annual average cost of infant care in New York state is $14,144. The average New York family with just one child pays 21.2 percent of their income on child care. For two kids, that rises to 38.7 percent.

For teachers with children, the problem is compounded by a decrease in salaries, benefits and general job security. The situation is equally dire for teachers of grade school, high school or college.

“These days, professors may be more likely than their students to be living in basement apartments and subsisting on ramen and Tabasco,” she writes.

At the professorial level, more colleges than ever, driven by bloated administrative bureaucracies, are relying on adjunct professors who receive low wages and no benefits. In the book, Quart cites one survey that found that 62 percent of adjunct professors earn less than $20,000 a year from teaching.

“A lot of things happened in [academia]. It became much more administrative,” says Quart, noting that tenured professor positions have been eliminated through attrition as more non-tenure track professors, such as adjuncts, were hired instead.

She writes that according to the Department of Education, “college and university administrative positions grew by 60 percent between 1993 and 2009 — 10 times the rate of growth of tenured faculty positions.”

By contrast, in 1975, Quart writes, “full-time tenure-stream professors were 45.1 percent of America’s professoriate. As of 2011, they are only 24.1 percent: Only one professor in six (16.7 percent) actually has tenure.”

“Something like 40 percent of teachers in American colleges and universities are adjuncts, which is insane,” Quart adds. “Middle-class parents are spending all their savings to pay for colleges where [their children are] going to be taught by people making $3,000 a class [per semester]. It’s going to change the quality of education, because people are teaching four classes a semester for no money.”

Quart profiled several struggling adjuncts in the book. Justin Thomas taught a total of four to six classes a semester at two colleges in Illinois. The first paid him $3,100 per class; the second, a paltry $1,675. Quart writes that “his paychecks arrived a month after each semester began, and during those four weeks it was macaroni and cheese and baked potatoes every night for his two daughters.”

Brianne Bolin, 35 years old with a disabled 8-year-old boy, taught four classes a year at Columbia College in Chicago for a grand total of $4,350 per class, per semester, never making more than $24,000 a year from teaching. At the time of the book’s writing, she shopped at Goodwill exclusively and relied on Medicaid and food stamps to feed her son.

Bolin began teaching at Westwood College in Chicago at age 26, switching to Columbia after one semester. She got pregnant at 28, then took two years off to care for her son.

When she returned to work, she got a rude awakening about how the realities of teaching had changed.

“Her boss warned her she’d never get a permanent job, [telling her], ‘Academia just isn’t a career choice anymore,’ ” Quart writes.

Those lucky enough to have a job in the field might find themselves needing to drive for Uber as well

Bolin quit teaching in 2016 and is now studying to become a speech pathologist. But the situation for professors has become so dire that before she left, she and two others founded PrecariCorps, a “nonprofit devoted to helping impoverished professors.”

So far, the “scrappy and fledgling” charity has “received over 100 donations and 50 requests for funding” and dispersed over $10,000 to professors in need.

If a charity for professors strikes you as sad, there is also a charity for members of another down and out profession, one that was once synonymous with high status and massive salaries — lawyers.

Leave Law Behind is an organization that helps lawyers exit the profession, declaring on its website that “there is an easier, less painful, less stressful and lucrative way to make money.” The organization’s founder, a former lawyer named Casey Berman, told Quart that “he saw his mission as ‘motivating’ former lawyers who are either broke or deeply frustrated, or both.”

In the book, Quart illustrates how lawyers are weighed down with massive debt while making a fraction of what they used to before the Great Recession — if they’re lucky enough to find a job at all.

“After the 2008 recession, law firms and corporations retained fewer lawyers,” she writes, noting that lawyers in some states have it worse than others.

“In Alaska, 56.7 percent of those with a law degree were not working as lawyers. In Tennessee, only 53.6 percent of degree holders were working as lawyers; in Missouri it’s 50.8, and in Maryland it’s 50.3 percent . . . there are excess attorneys in all but three states.” (For the record, those states are Rhode Island, North Dakota and Delaware.)

According to The New York Times, “10 months after graduation only 60 percent of the law school class of 2014 had found full-time jobs with longtime prospects.”

But those lucky enough to have a job in the field might find themselves needing to drive for Uber as well, since “lawyers may be making one-quarter of what they were making before 2008.”

The problem has been exacerbated by the automation of the review of legal documents, a task once accomplished by young lawyers. Programs like Viewpoint and Logikcull handle the organization, coding, retrieval and search of massive amounts of evidentiary documents, easily processing a slew of paperwork in ways that used to be done by people by hand. As a result, opportunities at the bottom of the profession have shrunk, taking pay levels down with them.

It’s the rare young lawyer who can get one of the few jobs remaining for this task, and they “are typically now earning just $17 to $20 an hour, while shouldering upward of $200,000 in student debt.”

As technology continues to advance, it will soon swallow the few entry-level jobs that are left, even as college debt continues to increase, Quart writes.

“The average law student’s debt was about $140,000 in 2012 — a 59 percent increase over 2004.”

While making ends meet is tougher than ever for teachers and lawyers, it’s even harder for those whose jobs have never been particularly secure.

Women in care professions, such as nannies, or even just professional women who become pregnant face similar standard-of-living obstacles, plus additional losses due to discrimination, Quart writes.

In the book, Quart notes that women’s salaries go down 7 percent for each child they bear and that cases of discrimination against women who become pregnant are on a massive upswing.

“In 2016,” she writes, “a report published by the Center for WorkLife Law found that so-called family-responsibilities discrimination cases had risen 269 percent over the last decade, even though the number of federal employee discrimination cases as a whole had decreased.”

This, Quart says, is due to a traditional lack of respect for caregivers.

“There’s a theory called Prisoner of Love, where people who do care work will accept lower wages supposedly because they love the people they’re being paid to care for. So they’re weakened by that, and they’re less part of a marketplace.”

As if these problems aren’t worrisome enough, Quart says technology is eliminating or degrading professions at a furious rate that will only increase, as “roughly 30 percent of the tasks within 60 percent of our current American occupations could soon be turned over to robots.”

The list of affected professions reads like a broad cross section of America, white-collar and blue-collar alike. Nurses, pharmacists, journalists, truckers, cashiers, tax preparers — very few professions will remain unaffected by advances in technology.

The problems have surprised many by reaching into the middle and upper-middle classes. The only people doing well in this economy, writes Quart, are the already wealthy, and our massive levels of income inequality are a significant factor.

“The United States is the richest and also the most unequal country in the world,” she writes. “It has the largest wealth inequality gap of the 200 countries in the [Credit Suisse Research Institute’s] Global Wealth Report of 2015. And when the top 1 percent has so much — so much more than even the top 5 or 10 percent — the middle class is financially and also mentally outclassed at each step.”

While the problems Quart lays out are sprawling and complex, she believes the only way out is to strengthen the social safety net. This includes considering solutions like universal basic income (UBI), which was first endorsed by President Richard Nixon in 1969 and is today supported by an unlikely mix of pundits on both sides of the political aisle.

“It’s like a monthly allowance for families and individuals that’s across the board, so it’s less of a handout for people specifically,” she says. “When I heard about it, I was thinking how much it would help, say, a mom I interviewed with two kids who had been laid off, or the professor who has a disabled kid and is on food stamps. If that person had $21,000 extra dollars a year through a basic income guarantee, would that have made all the difference?”

However we dig our way out — and especially if we don’t — Quart wants those who are struggling financially to realize that more and more people are in the same boat.

“There is a larger reason that your job is precarious and your parents’ jobs weren’t,” she writes. “It’s a system failure. It’s bigger than you.”