HANOI, Vietnam — A country once at war with the United States cozies up to its former enemy. Market reforms galvanize its economy, even as the Communist Party remains firmly in control.

As Vietnamese officials play host to the summit meeting between President Trump and Kim Jong-un of North Korea this week, they are offering up the hope that the North Koreans could somehow mirror Vietnam’s trajectory — transforming from a closed society strangled by central planners to a bustling nation full of capitalist enterprise.

In preparation for the two-day meeting that starts on Wednesday, Vietnam’s capital, Hanoi, has been festooned with North Korean and American flags, some of the stars and stripes fluttering upside down. Local restaurants are selling hamburgers garnished with kimchi, and one barber is offering free haircuts mimicking Mr. Kim’s and Mr. Trump’s signature styles.

Ideological fraternity has long bound Vietnam and North Korea. Now, as Mr. Kim is expected to tour Vietnamese industrial zones filled with foreign-invested factories, Vietnam has advice that might sound surprising from a nation that ejected American forces from its soil more than 40 years ago.