Cuddly is not an adjective that comes to mind when describing the Prime Ministers of either Japan or India. Shinzo Abe, like most Japanese politicians, often appears overly formal, while Narendra Modi has a reputation for being demanding and stern. But apparently the two feel warm and fuzzy about each other. Abe made the unusual gesture of welcoming Modi on his five-day official visit to Japan with an uncharacteristic hug. After that, the duo chatted over an informal dinner and strolled through a temple in the historic cultural center of Kyoto.

The leaders of Asia’s two most prominent democracies have good reasons to cozy up. Greater cooperation between India and Japan could prove critical in helping Abe and Modi achieve their economic goals at home and their strategic aims in the region — which means countering an aggressive China. That’s why the two have gushed about the importance of the India-Japan relationship. Modi said in a statement that his visit would “write a new chapter” in relations, while Abe in a Monday press conference said that their bilateral ties have the “most potential in the world.”

They have a lot of catching up to do. For economies of such size — Japan and India are the second and third largest in Asia, respectively — their exchange is still relatively small. Trade between the two reached only $15.8 billion in 2013 — a mere quarter of India’s trade with China. Japanese direct investment into India totaled $21 billion between 2007 and 2013, making Japan an extremely important investor for the country. But recently, the inflows have tapered off amid India’s economic slowdown. Over the past three years, Japanese firms have invested more in Vietnam and Indonesia than India.

That may be about to change. The fact is that the economic interests of the two nations dovetail nicely. Modi is looking to restart India’s slumbering economic growth by upgrading its woeful infrastructure, strengthening its manufacturing base and constructing a network of new “smart” cities across the nation — all of which Japanese money, technology and investment can help make a reality. Abe on Monday pledged $33 billion of financing and investment for India from public and private sources over the next five years. “Japanese trade and investment ties with India are set to strengthen significantly over the next decade and beyond,” Rajiv Biswas, Asia-Pacific chief economist for consulting firm IHS, predicted in a recent report.

Meanwhile, Abe is trying to jump-start a Japanese economy that has been stalled for two decades, and badly needs new sources of exports and revenue for ailing Japan Inc. India, with its 1.2 billion increasingly wealthy consumers and bottomless investment opportunities, can provide just what Japan requires. That is especially the case due to Tokyo’s souring relations with that other Asian giant, China. As tensions have risen over disputed islands in the East China Sea, investment and trade between China and Japan has deteriorated.

China is pressing Tokyo and New Delhi closer together for other reasons as well. Abe is trying to forge ties with countries across the region to contain a rising and increasingly assertive China. Meanwhile, Modi, who has his own territorial disputes with Beijing on India’s borders in the far east and north, is aiming to enhance the country’s military capabilities. Much of a joint declaration signed by the Prime Ministers dealt with strategic cooperation. The two pledged to “upgrade and strengthen” their partnership in defense by regularizing joint maritime exercises and collaborating on military technology.

China wasn’t specifically mentioned in the declaration, but which country Abe and Modi have in mind is no secret. Modi, in fact, took a clear swipe at Beijing in a speech to businessmen on Monday. “Everywhere around us, we see an 18th century expansionist mind-set: encroaching on another country, intruding in others’ waters, invading other countries and capturing territory,” Modi said.

None of this has gone unnoticed in the Middle Kingdom. An editorial in the state-run Global Times written in response to Modi’s comments attempted to downplay the friendly Abe-Modi summit. “The increasing intimacy between Tokyo and New Delhi will bring at most psychological comfort to the two countries,” the newspaper contended. “If Japan attempts to form a united front centered on India, it will be a crazy fantasy generated by Tokyo’s anxiety of facing a rising Beijing.”

Whether closer India-Japan ties are a fantasy will become apparent quickly. China’s President Xi Jinping is due to visit Modi in India later in September. Let’s see if he gets a hug.

Contact us at letters@time.com.