Hamburg, Germany (CNN) President Donald Trump, coming off a short visit to Poland, was greeted here in Germany on Thursday by the complex reality of foreign relations in the form of a pre-G20 meeting with German Chancellor Angela Merkel.

The two met at the Hotel Atlantic Kempinski Hamburg, where they shared a handshake and brief conversation before the two world leaders left reporters.

It was an instant contrast to the optics of their first meeting in March, which signaled a strained relationship.

JUST WATCHED Did Trump snub Merkel handshake? (March 2017) Replay More Videos ... MUST WATCH Did Trump snub Merkel handshake? (March 2017) 01:02

Trump did not shake Merkel's hand before cameras in the Oval Office, although they did at other times of her White House visit. And at a news conference later in the day, much to Merkel's chagrin, Trump make a joke about American spying practices that were found to have swept up the German chancellor's conversations during President Barack Obama's administration.

"As far as wiretapping I guess by this past administration, at least we have something in common, perhaps," Trump said, turning to Merkel, who didn't smile.

Read More