#include <iostream>

template <int K>
struct postbox
{
    int val() const 
    {
      return K;
    }
};

template <int A, int B, int C>
struct postoffice
{
  postbox<A> _a;

  template<int I>
  postbox<I> get_postbox()
  {
    switch( I )
    {
      case A: return _a;
    }
  }
};

template <typename PO>
struct zipcode
{
  PO my_postoffice;

  template<int K>
  postbox<K> get_postbox()
  {
    // The error is on this line
    return my_postoffice.template get_postbox<K>();
  }
};

// Here's a function template that isn't a member, and it compiles.
template<int D>
int non_member_function_template()
{
  postoffice<123,345,678> po;
  auto box = po.template get_postbox<D>();
  return box.val(); 
}

int main()
{
  std::cout << std::to_string(non_member_function_template<123>()) << std::endl;
}