%class Config
%language c++
%namespace Data::test
%{
  //C++ code here
  //it will be include before class declaration
#include &lt;iostream&gt;
#include "parameters.hh"
#include "variable.hh"

%}

%var            Parameters              param();
%var_list       Variable                vars();

%{
  //C++ Code here
  //it will be include in class declaration
%}

%%

//Code outside classe declaration
inline std::ostream& operator&lt;&lt;(std::ostream& s, const Config& v)
{
  v.get_param().print(s);
  for (std::list&lt;Variables*&gt;::const_iterator it = v.get_vars().begin();
       it != v.get_vars().end(); ++it)
    it-&gt;print(s);
  return s;
}
