President Obama on Thursday made a joke at the expense of Sen. Ted CruzRafael (Ted) Edward CruzWashington needs to end hidden inflation tax on our capital gains GOP tax writer introduces bill to reduce capital gains taxes Senators push to clear backlog in testing rape kits MORE (R-Texas) at a state dinner for Canadian Prime Minister Justin Trudeau. 

During his toast, Obama needled Cruz over widely debunked questions surrounding his eligibility to run for president.

The president said Americans and Canadians are both committed to the principle that “you can make it if you try,” no matter the circumstances of one’s birth.

“And we see this in our current presidential campaign,” Obama said. “After all, where else could a boy born in Calgary grow up to run for president of the United States?” 

The president made his crack at Cruz just minutes before a CNN Republican primary debate was set to begin.

Cruz’s chief rival in the race, businessman Donald TrumpDonald John TrumpWSJ: Trump ignored advice to confront Putin over indictments Trump hotel charging Sean Spicer ,000 as book party venue Bernie Sanders: Trump 'so tough' on child separations but not on Putin MORE, has repeatedly questioned whether the Texas Republican is a natural-born citizen — a constitutional requirement to be president. He was born in Canada to a Cuban father and American mother.

Most legal experts say Cruz’s Canadian birthplace isn’t an impediment to occupying the Oval Office. A New York judge this week threw out a lawsuit challenging his eligibility for to be president.

Obama is no stranger to the questions surrounding Cruz. Since he launched his first campaign, some of Obama’s critics have alleged he was born in Kenya and is not eligible to be president. Obama is a natural-born citizen; he was born in Hawaii to an American mother and Kenyan-born father.