On Tuesday, Rep. Nancy Pelosi, D-Calif., showed President Donald Trump how it's done.

The occasion was the now infamous public meeting Tuesday between Pelosi, Trump, Senate Minority Leader Chuck Schumer, D-N.Y., and Vice President Mike Pence to discuss avoiding a government shutdown at the end of next week. A major sticking point: the wall Trump would like to build on the Mexican border.

Trump turned up with flashcards. Pelosi took over and schooled Trump. She called the government shutdown the "Trump shutdown." She corrected misstatements. She kept her temper and focus as he interrupted her 15 times. And when he made a not-so-veiled reference to her ongoing fight to keep her speakership, she quickly filleted him. "Mr. President, please don't characterize the strength I bring to this meeting as the leader of the House Democrats, who just won a big victory."

When Pelosi exited the White House, she emerged the latest feminist heroine for the age of the female resistance to Trump. A snapshot showing her wearing a red coat and adjusting her sunglasses quickly became a Twitter and Facebook meme. "The name's Speaker . . . Speaker Pelosi. And she will be back," one tweet read.

It's about time.

It's long been obvious that many of the complaints about Pelosi's continued leadership are rooted in a combination of sexism and ageism that's widespread in American society. Schumer, 68, has made repeated strategic misjudgments, presided over a loss of Senate seats in the 2018 midterm election and was recently reported on by The New York Times as helping to protect Facebook in Washington while the company employs his daughter. Yet he faces no challenge to his leadership. Pelosi, 78, who saved the Affordable Care Act in 2010 and helped lead House Democrats to a 40-seat gain this year, is derided for her age and remains demonized on Fox News.

But that shouldn't surprise anyone. Middle-aged and older women have often found their efforts dismissed and derided. Hillary Clinton has faced repeated demands that she exit public life, something men who failed to win a presidential election such as Al Gore, John Kerry, John McCain and Mitt Romney did not contend with to the same degree. Elizabeth Warren's mishandling of her claims of Native American ancestry continue to receive an incredible amount of attention, while her strong, decades-long advocacy of consumer financial issues, of the sort that were at the heart of the Great Recession and our age of inequality, are somehow deemed secondary. When it comes to Democratic candidates who lost their elections in 2018, Beto O'Rourke, 46, is described as presidential material, while Stacey Abrams, 45, who frankly came a lot closer to winning her race, for governor in Georgia, seems all but forgotten. How does that work again?

Yet a study in the journal Democracy pointed out that women of a certain age played a pivotal role in the resistance to Trump, pouring their energies into volunteer roles on political campaigns, writing postcards, knocking on doors and making calls. These foot soldiers, the article noted, are typically “women from mid-life to early retirement years.” But thanks to the way bias works, they remain underrepresented when it comes to public attention. Yes, these younger women get derided more than men — as Alexandria Ocasio-Cortez, 29, pointed out on Twitter earlier this week, “Double standards are Paul Ryan being elected at 28 and immediately being given the benefit of his ill-considered policies considered genius; and me winning a primary at 28 to immediately be treated with suspicion & scrutinized, down to my clothing, of being a fraud” - but they are also heralded as the future. Numerous workplace surveys prove the point. A study released by Payscale in 2017 found that women’s salaries peak at age 40, while men can expect to see nearly another decade of financial gains. A paper published by the National Bureau of Economic Research in 2015 revealed that employers are more receptive to résumés from older men than the equivalent women; the authors concluded the only reason could be discrimination.

As for Pelosi, it’s likely that whatever remaining chances her opponents had of toppling her from the speakership ended on Tuesday, as her televised master class in getting the better of Trump went viral. (In fact, as I am editing this piece, word is coming down about a possible compromise to settle the dispute.) After Tuesday’s meeting, she returned to the House and said, “It’s like a manhood thing with him - as if manhood can be associated with him. This wall thing.” For good measure, she added, she was “trying to be the mom.” Oof. Trump, on the other hand, acted like the toddler Pelosi so clearly thought he was - the Los Angeles Times reported, “Trump appeared upset after leaving the meeting, flicking a folder and sending its papers flying out.” No word on whether he stamped his feet too.

I am not arguing Pelosi is perfect. She is not. But she has decades of experience in both life and politics, and she used it to great impact on Tuesday. Trump has a preternatural instinct for reality-television-like spectacles, and it’s a rare person, male or female, who gets the better of him when it comes to getting down in the mud. But Pelosi took her greater experience and understanding of policy and the legislative process, not to mention the knowledge that men often put women down because they fear their laughter and contempt, and used it to give a master class in how to show up Trump as the blustering, less-than-well-informed bully he is. It was a bravura performance.

Helaine Olen is the author of “Pound Foolish: Exposing the Dark Side of the Personal Finance Industry.”

Helaine Olen