Though quite a few tech companies that were granted sky-high valuations by venture capitalists have sputtered since going public, payments and financial services upstart Square Inc.  (SQ) - Get Report is one name for which criticized VC investors can take a victory lap, and perhaps even gloat a little.

After all, this was a company that went public in late 2015 at a valuation about 40% below what it was worth in a funding round in 2014 ($6 billion). And it's also one which -- unlike streaming hardware/platform provider Roku Inc. (ROKU) - Get Report , which shot higher after its first post-IPO earnings report -- was stuck in a fairly depressed range for about a year before starting a big rally that has now left it valued at over $17 billion.

There are some parallels between how Square and Roku were misunderstood by investors -- particularly regarding how each company's efforts to monetize a large user base via higher-margin software and services wasn't appreciated. But to the extent that Square's losses scared off public investors for a long time, there are also some parallels with cloud storage/collaboration firm Box Inc. (BOX) - Get Report . Like Square, Box was another former tech "unicorn" whose shares sputtered for a while after going public, before eventually turning a corner and more than doubling.

During its first four reported quarters following its IPO, Square had adjusted EPS of negative $0.21 and free cash flow (FCF) of negative $64 million. Two big culprits: The gross margins for Square's core payment-processing services weren't (and still aren't) that high -- particularly after accounting for a now-expired deal with Starbucks Inc (SBUX) - Get Report featuring negative gross margins (GMs). Secondly, the company was rapidly growing its R&D spend to help it expand the stable of higher-margin services it could cross-sell customers.

For Box, the issue was less about R&D spend or margins than the massive sums the company spent on sales to grow out a corporate client base that topped 76,000 as of July. During Box's first post-IPO reporting quarter, as well as the quarters immediately preceding it, the company's sales and marketing spend single-handedly exceeded its revenue. FCF for the first post-IPO quarter and the three quarters following it was negative $145 million. Naturally, this stoked fears about just how profitable Box's business model was over the long run.

Image placeholder title

Gradually, both Square and Box put those bottom-line worries to rest. Square did so by complementing healthy transaction growth with significant growth for a subscription and value-added services business whose third-quarter GM (72%) was roughly twice that of the payment-processing business.

Thanks to offerings such as Instant Deposit (lets Square clients instantly access funds), Caviar (online food-delivery), Square Payroll (payroll-processing), Square Employee Management, Square Marketing (e-mail/social marketing), Square Invoices (online invoice payment), Square Gift Cards (custom gift cards), Square for Retail (retail point-of-sale software) and Square Capital (small-business loans), the company's "subscription and services-based revenue" grew to $65.1 million in Q3 from $35.3 million a year earlier and $14.7 million two years earlier. And with many of Square's value-added offerings still in the early stages of being adopted, there could be a lot more growth to come.

Box, meanwhile, has been successfully executing a "land-and-expand" strategy through which deals that might initially cover a small percentage of an enterprise's workers (perhaps one or two departments) are gradually widened. The company has also been making headway up-selling buyers of its core cloud storage and file-sharing offerings on value-added solutions covering services such as encryption-key management, data governance and support for custom business workflows and apps that leverage Box's platform.

As Box -- aided by alliances with IBM Corp.  (IBM) - Get Report and other big enterprise IT names -- has made headway with this strategy, sales/marketing spend has gradually dropped as a percentage of revenue. During Box's July quarter, it came in at 57% of revenue on a GAAP basis and 53% on a non-GAAP basis. Those numbers are still high, but largely on par with other fast-growing enterprise software upstarts.

And this improvement has done wonders for Box's cash-flow profile. FCF improved to negative $24.8 million in fiscal 2017 (ended in January) from fiscal 2016's negative $139.3 million. On average, analysts polled by FactSet expect FCF to be slightly positive in fiscal 2018 and top $93 million in fiscal 2020.

Notably, given the one-time criticism of their private valuations, Square and Box are both situations where a more VC-like mindset regarding customer/user growth and short-term losses would have served investors well. Such a mindset would recognize the large customer bases Square and Box were absorbing big losses to create had immense long-term value. And also that -- as long as those customers remained loyal, and Square/Box's platforms remained differentiated -- the companies would figure out how to profit from them, thanks to up-selling efforts and operating leverage.

Like Roku, Square and Box are companies for which fears of competition from deep-pocketed rivals were overblown. Square has fended off the likes of NCR Corp. (NCR) - Get Report , Paypal Holdings Inc. (PYPL) - Get Report and Groupon Inc. (GRPN) - Get Report , while Box has kept the likes of Microsoft Corp. (MSFT) - Get Report , Alphabet Inc./Google (GOOGL) - Get Report and Dropbox at bay.

Due to a mixture of proprietary software, value-added solutions and large developer ecosystems (and in Square's case, proprietary hardware as well), both companies' platforms have been far more difficult for a big-name rival to imitate than many assumed. And it certainly hasn't hurt that unlike the aforementioned rivals, Square and Box are  sharply focused on small-business services and cloud content management offerings, respectively. In so many hotly-competitive tech markets, focus and competent management can go a long way.

As always, hindsight vision is 20/20, and pulling the trigger on a buy order can be easier said than done when bearish commentary about heavy losses and tough competition is widespread. But at the very least, the lessons delivered by Square and Box's public-market turnaround provide some food for thought the next time one comes across a rapidly-growing, money-losing upstart with a loyal customer base that it's still figuring out how to make money from.

Jim Cramer and the AAP team hold positions in Alphabet and Starbucks for their Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells GOOGL or SBUX? Learn more now.

More of What's Trending on TheStreet: