#include <iostream>
using namespace std;

template < class Count >
struct Counter {
	using count_type = Count;
	count_type instances = 0;
};

template < class Cnt, Cnt& c>
struct Counted {
	using id_type = typename Cnt::count_type;
	id_type id;
	Counted() : id(c.instances) { ++c.instances; }
	~Counted() { --c.instances; }
};

template < class Cnt, Cnt& c >
std::ostream& operator<<(std::ostream& os, Counted<Cnt,c> sib) {
	os << "printing sibling " << sib.id;
	return os;
}

using SCounter = Counter<std::size_t>;
SCounter sc;
using SCounted = Counted<SCounter, sc>;

int main() {
	// your code goes here
	SCounted i, j, k; // --> ok, works fine
	std::cout << j << std::endl;
	return 0;
}