#include <iostream>
#include <vector>
#include <iterator>
using namespace std;

// print a vector
template<typename T1>
std::ostream& operator <<( std::ostream& out, const std::vector<T1>& object )
{
    out << "[";
    if ( !object.empty() )
    {
        //std::copy( object.begin(), --object.end(), std::ostream_iterator<T1>( out, ", " ) );
        for(typename std::vector<T1>::const_iterator t = object.begin(); t != object.end() - 1; ++t) {
        	out << *t << ", ";
        }
        out << *--object.end(); // print the last element separately to avoid the extra characters following it.
    }
    out << "]";
    return out;
}

int main()
{
    vector<vector<int> > a;
    vector<int> b;
    //cout << b ; // Works fine for this
    cout << a; // Compiler error
}  